package org.traffometer.traffobase.model;

import java.util.Iterator;
import java.util.List;

import org.traffometer.common.data.TraffoPacket;

/**
 * Represents an ordered set of packets.  Generally a PacketStore will have some kind of persistent
 * back end. 
 * @author Mark Stillwell
 */
public interface PacketStore extends Iterable<TraffoPacket> {

  /**
   * Adds a TraffoPacket to the PacketStore. Returns true if the operation was successful.
   * @param packet a packet to add to the PacketStore
   * @return true if the packet has been added
   */
  public boolean add(TraffoPacket packet);

  /**
   * Removes all TraffoPackets from this PacketStore.
   */
  public void clear();

  /**
   * Returns an iterator over the TraffoPackets in this PacketStore.
   * @return an iterator over the PacketStore
   * @see java.lang.Iterable#iterator()
   */
  public Iterator<TraffoPacket> iterator();
  
  /**
   * Getter for list of TraffoPackets.
   * 
   * @return the packets
   */
  public List<TraffoPacket> getPackets();
}